﻿using System;
using System.Reflection;
using System.Windows.Data;

namespace SoftSource.Timecard.Converters
{
    public class ObjectToExecutingAssemblyVersionConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var executingAssembly = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = new AssemblyName(executingAssembly.FullName);
            return assemblyName.Version.ToString(3);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
